package com.topboya.linker.ui.activity;

import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.topboya.linker.R;
import com.topboya.linker.api.persistentcookiejar.netprovider.TrustAnyHostnameVerifier;
import com.topboya.linker.model.response.LatelyDataResponse;
import com.topboya.linker.model.response.ProductInforListReponse;
import com.topboya.linker.ui.adapter.ProductAdapter;
import com.topboya.linker.ui.base.activity.BaseActivity;
import com.topboya.linker.ui.presenter.ProduceInfoPresenter;
import com.topboya.linker.ui.view.ProduceInfoView;
import com.topboya.linker.utils.LogUtils;
import com.topboya.linker.utils.UIUtils;

import java.util.ArrayList;
import java.util.List;

public class ProductInforActivity extends BaseActivity<ProduceInfoView, ProduceInfoPresenter> implements ProduceInfoView {
    private static final String TAG = "ProductInforActivity:";
    private RecyclerView recycle_produceinfo;

    @Override
    protected int getLayoutId() {

        return R.layout.activity_productinfo;
    }

    @Override
    protected void initView() {

        recycle_produceinfo = findViewById(R.id.recycle_produceinfo);

    }

    @Override
    protected void initData() {

        mPresenter.getProductInforList("0",null,"1");
    }

    @Override
    protected void initListener() {

    }

    @Override
    protected ProduceInfoPresenter createPresenter() {

        return new ProduceInfoPresenter(this);
    }


    @Override
    public void setProductInfoCustomeData(ArrayList<ProductInforListReponse.ProductDetailInfoList> productDetailInfoLists,String count) {

        RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(this,
                LinearLayoutManager.VERTICAL, false);

        ProductAdapter productAdapter = new ProductAdapter(R.layout.product_item, productDetailInfoLists);
        recycle_produceinfo.setLayoutManager(layoutManager);
        recycle_produceinfo.setAdapter(productAdapter);
        productAdapter.setOnItemClickListener((adapter, view, position) -> UIUtils.showToast("item：" + position));
    }

    @Override
    public void setLatelyData(List<LatelyDataResponse.Data> latelyData) {

    }
}